//
//  CYInformationOneImageTableViewCell.m
//  cyydt
//
//  Created by chu on 2019/2/3.
//  Copyright © 2019 chu. All rights reserved.
//

#import "CYInformationOneImageTableViewCell.h"

@implementation CYInformationOneImageTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    self.timeLabel.hidden = YES;
    self.timeLabel.layer.cornerRadius = 9;
    self.timeLabel.layer.masksToBounds = YES;
    self.timeLabel.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.4];
}

- (void)setModel:(CYProjectModel *)model{
    _model = model;
    self.timeLabel.hidden = YES;
    NSArray *imgs = [model.images componentsSeparatedByString:@","];
    self.label1.text = model.catname;
    self.label3.text = model.created_time;
    self.label2.text = [NSString stringWithFormat:@"%@评论",model.comment_number];
    [self.headImageView sd_setImageWithURL:[NSURL URLWithString:imgs[0]] placeholderImage:[UIImage imageWithColor:[UIColor lightGrayColor] Size:self.headImageView.frame.size]];
    
    self.titleLabel.text = model.title;
    
}

- (void)setVideoModel:(CYProjectModel *)videoModel{
    _videoModel = videoModel;
    
    self.label1.text = videoModel.catname;
    self.label3.text = videoModel.glance_time;
    self.label2.text = [NSString stringWithFormat:@"%@评论",videoModel.comment_number];
    [self.headImageView sd_setImageWithURL:[NSURL URLWithString:videoModel.cover_url] placeholderImage:[UIImage imageNamed:@"videoPlacehold"]];
    
    self.titleLabel.text = videoModel.title;
    
    if ([NSString stringIsNull:videoModel.play_time_format]) {
        self.timeLabel.hidden = YES;
    }else{
        self.timeLabel.hidden = NO;
        self.timeLabel.text = videoModel.play_time_format;
    }
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
